﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Drawing;

namespace FicusFactor.Watermarker
{
    [Guid("8E0AB201-BBDC-443B-A53C-9C4B82C742AB")]
    [ComVisible(true)]
    public sealed class Configurator : WatermarkerBase, IDisposable
    {
        private ConfiguratorForm configuratorUI;

        public override void Drop(IDataObject dataObject, uint keyState, Point pt, ref uint effect)
        {
            if (null == configuratorUI)
            {
                configuratorUI = new ConfiguratorForm();
            }

            base.Drop(dataObject, keyState, pt, ref effect);
            configuratorUI.SetPreviewImage(Files[0]);
            configuratorUI.ShowDialog();
        }

        #region IDisposable Members

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (null != configuratorUI && false == configuratorUI.IsDisposed)
            {
                configuratorUI.Dispose();
            }
        }

        #endregion
    }
}
